package com.ruoyi.system.service.impl;

import com.ruoyi.common.core.domain.entity.CarLog;
import com.ruoyi.system.mapper.CarLogMapper;
import com.ruoyi.system.service.ICarLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

/**
 * 车辆日志管理Service实现
 *
 * @author yourname
 * @date 2025-06-06
 */
@Service
public class CarLogServiceImpl implements ICarLogService {

    @Autowired
    private CarLogMapper carLogMapper;

    @Override
    public CarLog selectCarLogByCarSn(String carSn) {
        return carLogMapper.selectByCarSn(carSn);
    }

    @Override
    public CarLog selectCarLogByCarSnAndInTime(String carSn, Date inTime) {
        return carLogMapper.selectByCarSnAndInTime(carSn, inTime);
    }

    @Override
    @Transactional
    public int insertCarLog(CarLog carLog) {
        return carLogMapper.insert(carLog);
    }

    @Override
    @Transactional
    public int updateCarLogOutTime(String carSn, Date inTime, Date outTime, Integer outStatus) {
        return carLogMapper.updateOutTime(carSn, inTime, outTime, outStatus);
    }
}
